﻿using ET.DBCommon.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ET.ScoreTeacherClient.Views
{
    /// <summary>
    /// SceneDeductPoints.xaml 的交互逻辑
    /// </summary>
    public partial class SceneDeductPoints : Window
    {
        public ObservableCollection<ExamresultsTestQuestionModel> ExamresultsTestQuestions { get; set; }
        public SceneDeductPoints(ObservableCollection<ExamresultsTestQuestionModel> m_ExamresultsTestQuestions)
        {
            InitializeComponent();
            this.ExamresultsTestQuestions = m_ExamresultsTestQuestions;
        }

        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            var question = this.cmbQuestion.SelectedItem as ExamresultsTestQuestionModel;
            if (question == null)
            {
                MessageBox.Show("选择扣分场景！");
                return;
            }
            if (!decimal.TryParse(this.txtScore.Text, out decimal score))
            {
                MessageBox.Show("分值请输入数字！");
                return;
            }
           // AccountServiceHelper.Instance.SceneDeductPoints(question.ID, this.txtExplain.Text.Trim(), score);
            this.Close();
        }

        private void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.cmbQuestion.ItemsSource = this.ExamresultsTestQuestions;
        }
    }
}
